1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module sourceview.SearchSettings; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import glib.c.functions; 30 private import gobject.ObjectG; 31 private import sourceview.c.functions; 32 public import sourceview.c.types; 33 34 35 /** 36 * Search settings. 37 * 38 * A `GtkSourceSearchSettings` object represents the settings of a search. The 39 * search settings can be associated with one or several 40 * [class@SearchContext]s. 41 */ 42 public class SearchSettings : ObjectG 43 { 44 /** the main Gtk struct */ 45 protected GtkSourceSearchSettings* gtkSourceSearchSettings; 46 47 /** Get the main Gtk struct */ 48 public GtkSourceSearchSettings* getSearchSettingsStruct(bool transferOwnership = false) 49 { 50 if (transferOwnership) 51 ownedRef = false; 52 return gtkSourceSearchSettings; 53 } 54 55 /** the main Gtk struct as a void* */ 56 protected override void* getStruct() 57 { 58 return cast(void*)gtkSourceSearchSettings; 59 } 60 61 /** 62 * Sets our main struct and passes it to the parent class. 63 */ 64 public this (GtkSourceSearchSettings* gtkSourceSearchSettings, bool ownedRef = false) 65 { 66 this.gtkSourceSearchSettings = gtkSourceSearchSettings; 67 super(cast(GObject*)gtkSourceSearchSettings, ownedRef); 68 } 69 70 71 /** */ 72 public static GType getType() 73 { 74 return gtk_source_search_settings_get_type(); 75 } 76 77 /** 78 * Creates a new search settings object. 79 * 80 * Returns: a new search settings object. 81 * 82 * Throws: ConstructionException GTK+ fails to create the object. 83 */ 84 public this() 85 { 86 auto __p = gtk_source_search_settings_new(); 87 88 if(__p is null) 89 { 90 throw new ConstructionException("null returned by new"); 91 } 92 93 this(cast(GtkSourceSearchSettings*) __p, true); 94 } 95 96 /** 97 * Returns: whether to search at word boundaries. 98 */ 99 public bool getAtWordBoundaries() 100 { 101 return gtk_source_search_settings_get_at_word_boundaries(gtkSourceSearchSettings) != 0; 102 } 103 104 /** 105 * Returns: whether the search is case sensitive. 106 */ 107 public bool getCaseSensitive() 108 { 109 return gtk_source_search_settings_get_case_sensitive(gtkSourceSearchSettings) != 0; 110 } 111 112 /** 113 * Returns: whether to search by regular expressions. 114 */ 115 public bool getRegexEnabled() 116 { 117 return gtk_source_search_settings_get_regex_enabled(gtkSourceSearchSettings) != 0; 118 } 119 120 /** 121 * Gets the text to search. 122 * 123 * The return value must not be freed. 124 * 125 * You may be interested to call [func@utils_escape_search_text] after 126 * this function. 127 * 128 * Returns: the text to search, or %NULL if the search is disabled. 129 */ 130 public string getSearchText() 131 { 132 return Str.toString(gtk_source_search_settings_get_search_text(gtkSourceSearchSettings)); 133 } 134 135 /** 136 * Returns: whether to wrap around the search. 137 */ 138 public bool getWrapAround() 139 { 140 return gtk_source_search_settings_get_wrap_around(gtkSourceSearchSettings) != 0; 141 } 142 143 /** 144 * Change whether the search is done at word boundaries. 145 * 146 * If @at_word_boundaries is %TRUE, a search match must start and end a word. 147 * The match can span multiple words. See also [method@Gtk.TextIter.starts_word] and 148 * [method@Gtk.TextIter.ends_word]. 149 * 150 * Params: 151 * atWordBoundaries = the setting. 152 */ 153 public void setAtWordBoundaries(bool atWordBoundaries) 154 { 155 gtk_source_search_settings_set_at_word_boundaries(gtkSourceSearchSettings, atWordBoundaries); 156 } 157 158 /** 159 * Enables or disables the case sensitivity for the search. 160 * 161 * Params: 162 * caseSensitive = the setting. 163 */ 164 public void setCaseSensitive(bool caseSensitive) 165 { 166 gtk_source_search_settings_set_case_sensitive(gtkSourceSearchSettings, caseSensitive); 167 } 168 169 /** 170 * Enables or disables whether to search by regular expressions. 171 * 172 * If enabled, the [property@SearchSettings:search-text] property contains the 173 * pattern of the regular expression. 174 * 175 * [class@SearchContext] uses #GRegex when regex search is enabled. See the 176 * [Regular expression syntax](https://developer.gnome.org/glib/stable/glib-regex-syntax.html) 177 * page in the GLib reference manual. 178 * 179 * Params: 180 * regexEnabled = the setting. 181 */ 182 public void setRegexEnabled(bool regexEnabled) 183 { 184 gtk_source_search_settings_set_regex_enabled(gtkSourceSearchSettings, regexEnabled); 185 } 186 187 /** 188 * Sets the text to search. 189 * 190 * If @search_text is %NULL or is empty, the search will be disabled. A copy of @search_text 191 * will be made, so you can safely free @search_text after a call to this function. 192 * 193 * You may be interested to call [func@utils_unescape_search_text] before 194 * this function. 195 * 196 * Params: 197 * searchText = the nul-terminated text to search, or %NULL to disable the search. 198 */ 199 public void setSearchText(string searchText) 200 { 201 gtk_source_search_settings_set_search_text(gtkSourceSearchSettings, Str.toStringz(searchText)); 202 } 203 204 /** 205 * Enables or disables the wrap around search. 206 * 207 * If @wrap_around is %TRUE, the forward search continues at the beginning of the buffer 208 * if no search occurrences are found. Similarly, the backward search continues to search at 209 * the end of the buffer. 210 * 211 * Params: 212 * wrapAround = the setting. 213 */ 214 public void setWrapAround(bool wrapAround) 215 { 216 gtk_source_search_settings_set_wrap_around(gtkSourceSearchSettings, wrapAround); 217 } 218 }